<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>京城男人帮---新增地址</title>
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/home/css/head.css" />
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/home/css/footer.css" />
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/home/css/suercenter.css" />
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/home/css/index.css"/>
	<script src="__PUBLIC__/home/js/jquery-1.7.2.min.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
        function over(){
            var div = document.getElementById('alltype');//获取大div对象
            var text = document.getElementById('indextype');//获取文字div对象
            text.style.display="block";
        }//鼠标进入显示文字
        function out(){
            var div = document.getElementById('alltype');
            var text = document.getElementById('indextype');
            text.style.display="none";
        }//鼠标退出不显示文字
    </script>
    <style type="text/css" media="screen">
        #indextype{
            position: relative;
            float: left;
            top: 0;
            left: 50%;
            margin-left: -600px;
            width: 215px;
            height: 380px;
            background-color: #C81623;
            z-index: 4;

        }
    </style>
</head>
<body>
	<!--顶部公用-->
	{include file="public/top"}
    <!--头部end-->
	<!-- 菜单 -->
    {include file="public/all_type"}
    <!-- 菜单 -->
	<div class="w1000 ClearFix margin_top20">
		<!--左侧end-->
        {include file="public/ur_left"}
		<!--左侧end-->
		<div class="ur_right">
			<!--uer_top-->
			<div class="ur_location">
				<a href="">我的快乐购</a>
				<span>&gt;</span>
				<a class="a_cur">地址管理</a>
			</div>
			<!--uer_top-->
			<div class="o_o_part">
				<div class="part_h2">新增/修改收货地址</div>
				<form action="newPathAdd" method="post">
					<input name="token_key_id" value="" type="hidden">
					<input name="form_submit" value="ok" type="hidden">
					<div class="new_addr">
						<div class="addr_item">
							<span class="label_n"><span class="c_red">*</span>收货人：</span>
							<input class="itxt" name="true_name" id="true_name" type="text">
							<div class="addr_msg">
								<span id="error_true_name"></span>
							</div>
						</div>
						<!-- 地址联动 -->
						<div class="addr_item">
							<span class="label_n"><span class="c_red">*</span>所在地区：</span>
							<select class="city" name="country[]" id="statename">
								<option value="0">请选择地区</option>
								<?php foreach ($areaData as $key => $value): ?>
									<option value="<?php echo $value['area_id'] ?>"><?php echo $value['area_name'] ?></option>
								<?php endforeach ?>
							</select>
							<div class="addr_msg">
								<span id="error_statename"></span>
							</div>
						</div>
						<!-- 地址联动 -->

						<div class="addr_item">
							<span class="label_n"><span class="c_red">*</span>详细地址：</span>
							<input placeholder="详细地址" name="address" class="itxt itxtaddr" id="address" type="text">
							<div class="addr_msg">
								<span id="error_address"></span>
							</div>
						</div>
						<div class="addr_item">
							<span class="label_n"><span class="c_red">*</span>手机号码：</span>
							<input placeholder="手机号码" name="tel_phone" class="itxt itxt_tel" id="tel_phone" type="text">
							<div class="addr_msg">
								<span id="error_tel_phone"></span>
							</div>
						</div>
						<div class="addr_item btn_item">
							<a href="javascript:;" id="addresssubmit" class="btn_addaddr">确定</a>
						</div>
					</div>
				</form>
			</div>
			<!--pathend-->
			<div class="addr_list">
				<div class="addr_l_h2">
					已保存收货地址（<span>0</span>）
				</div>
				<table class="order_table">
					<thead class="theads">
						<tr>
							<td style="padding-left: 40px;">收货人</td>
							<td>收货人地址</td>
							<td>手机</td>
							<td>操作</td>
						</tr>
					</thead>
					<tbody>
						<tr class="tr-line">
							<td colspan="5">您还没有任务收货地址 </td>
						</tr>
					</tbody>
				</table>
			</div>
		</div>
	</div>
	<!--底部公用-->
    {include file="public/footer"}
    <!--底部end-->
</body>
</html>
<script >
	// 绑定地区联动事件
	$(document).on("change",".city",function(){
		var area_id = $(this).val();
		var _this = $(this);
		$.ajax({
			url:"newPath",
			data:{area_id:area_id},
			dataType:"json",
			success:function(res){
				if(area_id>0){
					if(res.areaData.length>0){
						var select = '<select class="city" name="country[]" id="statename">';
						select +='<option value="0">请选择地区</option>';
						$.each(res.areaData,function(i,v){
							select += '<option value="'+v.area_id+'">'+v.area_name+'</option>';
						})
						select +='</select>';
						_this.nextAll('.addr_item select').remove();
						_this.after(select);
					}
				}else{
					_this.nextAll('.addr_item select').remove();
				}
			}
		})
	})
</script>